<template>
	<view>
		<view class="container" :class="popup.show==true?'on':''">
			<view class="header">
				<text class="title">TA提到的宝贝</text>
				<text class="iconfont icon-guanbi5" @click="closePopup"></text>
			</view>
			<view class="main_count">
				<scroll-view scroll-y="true">
					<view v-for="(item, index) in list" :key="index" @click="goDetail(item.spu)" class="list">
						<view class="pro_list">
							<view class="picture">
								<image :src="item.spu && item.spu.image" class="image"></image>
							</view>
							<view class="info">
								<view class="name line2">{{item.spu && item.spu.store_name}}</view>
								<view class="price">￥<text>{{item.spu && item.spu.price}}</text></view>
							</view>
						</view>
						
					</view>
				</scroll-view>
				
			</view>	
		</view>
		<view class='mask' catchtouchmove="true" :hidden='popup.show==false' @tap="closePopup"></view>
	</view>
	
</template>

<script>
	import { goShopDetail } from '@/libs/order.js'
	export default {
		props:{
			list: {
				type: Array,
				default: []
			},
			uid: {
				type: Number,
			},
			community_id: {
				type: String,
			}
			
		},
		data() {
			return {
				popup: {
					show: false
				},
				
			};
		},
		methods: {
			// 点击关闭按钮
			closePopup() {
				this.$set(this.popup, 'show', false);
			},
			showPopup() {
				this.$set(this.popup, 'show', true);
			},
			goDetail(item){
				if (item.product_type === 1) {
					uni.navigateTo({
						url: `/pages/activity/goods_seckill_details/index?id=${item.product_id}&time=${item.stop_time}&spid=${this.uid}`
					})
				} else if (item.product_type === 2) {
					uni.navigateTo({
						url: `/pages/activity/presell_details/index?id=${item.activity_id}&spid=${this.uid}`
					})
				} else if (item.product_type === 0) {
					console.log(this.community_id==='')
					if(this.community_id===''){
						uni.navigateTo({
							url: `/pages/goods_details/index?id=${item.product_id}&spid=${this.uid}`
						})	
					}else{
						uni.navigateTo({
							url: `/pages/goods_details/index?id=${item.product_id}&spid=${this.uid}&community_id=${this.community_id}`
						})	
					}
					// return false;
					// uni.navigateTo({
					// 	url: `/pages/goods_details/index?id=${item.product_id}&spid=${this.uid}`
					// })	
				}else if (item.product_type === 4) {
					uni.navigateTo({
						url: `/pages/activity/combination_details/index?id=${item.activity_id}&spid=${this.uid}`
					})
				}else if (item.product_type === 40) {
					uni.navigateTo({
						url: `/pages/activity/combination_status/index?id=${item.activity_id}&spid=${this.uid}`
					})
				}	
			}
		}
	}
</script>

<style lang="scss" scoped>
.container{
	position: fixed;
	bottom: 0;
	width: 100%;
	left: 0;
	background-color: #ffffff;
	z-index: 77;
	border-radius: 16rpx 16rpx 0 0;
	// padding-bottom: 20rpx;
	transform: translate3d(0, 100%, 0);
	transition: all .3s cubic-bezier(.25, .5, .5, .9);
	max-height: 1000rpx;
	&.on {
		transform: translate3d(0, 0, 0);
	}
	
	.header{
		position: relative;
		padding: 40rpx 30rpx;
		.title{
			color: #282828;
			font-size: 30rpx;
		}
		.iconfont{
			color: #8A8A8A;
			font-size: 28rpx;
			position: absolute;
			top: 0;
			right: 0;
		}
		.icon-guanbi5 {
			right: 20rpx;
			color: #8a8a8a;
			font-size: 30rpx;
			line-height: 30rpx;
			top: 20rpx;
			background-color: transparent;
			font-weight: normal;
		}
		
	}
	scroll-view{
		max-height: 800rpx;
	}
	.main_count{
		padding: 0 20rpx 30rpx;
		max-height: 800rpx;
		overflow-y: scroll;
		/* #ifndef MP */
		margin-bottom: 90rpx;
		/* #endif */
		.list{
			margin-bottom: 40rpx;
			&:last-child{
				margin-bottom: 0;
			}
		}
		.pro_list{
			display: flex;
			.picture,.image,uni-image{
				width: 200rpx;
				height: 200rpx;
				border-radius: 8rpx;
			}
			.info{
				margin-left: 30rpx;
				position: relative;
				.name{
					color: #282828;
					font-size: 30rpx;
					line-height: 45rpx;
				}
				.price{
					color: #E93323;
					position: absolute;
					left: 0;
					bottom: 5rpx;
					font-size: 20rpx;
					font-weight: bold;
					text{
						font-size: 26rpx;
						
					}
				}
			}
		}
	}
	
}
</style>
